<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	<title>风味-快递状态</title>
	<link rel="stylesheet" type="text/css" href="css/personCenterPublic.css"/>
	<link rel="stylesheet" type="text/css" href="css/expressStatus.css"/>
	<script src="js/jquery-2.1.0.js"></script>

</head>
<body>
<div id="back">
	<a href="#" onClick="javascript :history.back(-1);"><&nbsp;返回我的快递</a>
</div>
<div id="left">
	<img src="img/maodian.png"/>
</div>
<!--这里面的img随着下面订单状态有choose的属性改变-->
<div id="right">
	<ul>
		<li id="finish">交易完成</li>
		<li id="car">运送中
			<br /><span>请耐心等待</span>
		</li>
		<li id="sellers" class="choose">订单正在进行中</li>
		<li id="born" class="choose">卖家接单
			<br /><span>时刻关注快递状态哦~</span>
		</li>
	</ul>
</div>
<script type="text/javascript">
	function getUrl(){
		var str = location.href;//获取传过来的地址
		var arr = str.split("?");
		var str1 = arr[1];//获取？之后的内容
		var id = str1.split("=")[1];
		return id;
	}

	$.ajax("/fengwei/PreOrder/getById",{
		type:"get",
		data:{
			'preorderId':getUrl()
		},
		success:function(data){
			var dataObj = eval('('+data+')');
			var statu = dataObj.preorderStatus
			setData(statu);
		},
		error:function(){

		}

	})

	var left=document.getElementById('left');
	var leftimg=left.getElementsByTagName('img')[0];
	var right=document.getElementById('right');
	var finish=document.getElementById('finish');
	var car=document.getElementById('car');
	var sellers=document.getElementById('sellers');
	var born=document.getElementById('born');

	function setData(statu){
		if(statu == 1){
			$('#born').addClass('choose');
		} else if(statu == 2){
			$('#born').addClass('choose');
			$('#sellers').addClass('choose');
		} else if(statu == 3){
			$('#born').addClass('choose');
			$('#sellers').addClass('choose');
			$('#car').addClass('choose');
		} else if(statu == 4){
			$('#born').addClass('choose');
			$('#sellers').addClass('choose');
			$('#car').addClass('choose');
			$('#finish').addClass('choose');
		}

		if(finish.className=='choose'){
			leftimg.setAttribute('src','img/maodianchoose3.png');
		}else if(car.className=='choose'){
			leftimg.setAttribute('src','img/maodianchoose2.png');
		}else if(sellers.className=='choose'){
			leftimg.setAttribute('src','img/maodianchoose1.png');
		}
	}

</script>
</body>
</html>
